<?php

/*
 * Niken Larasati
 * larasati.n@students.amikom.ac.id
 */

class pengguna_m extends CI_Model {
    public function __construct() {
        parent::__construct();
    }

    function ambil_data() {
        $this->db->select('pengguna.idpengguna as idpengguna,pengguna.nama as nama,pengguna.alamat as alamat, '
                . 'pengguna.no_telp as no_telp, pengguna.username as username,'
                . 'pengguna.password as password,pengguna.level as level');
        $this->db->from('pengguna');
        return $this->db->get();
    }
    
    function cek_login($username, $password){
        $this->db->select('pengguna.nama as nama,'
                . ' pengguna.level as level, pengguna.username as username');
        $this->db->from('pengguna');
        $this->db->where('pengguna.username',$username);
        $this->db->where('pengguna.password',$password);
        
        return $this->db->get();
    }
    
    function detail_pengguna($id){
        $this->db->select('*');
        $this->db->from('pengguna');
        $this->db->where('idpengguna', $id);
        return $this->db->get();
    }

}

?>